
angular.module('mamApp').factory('PersonalInformationManager', ['$http','api', function ($http,api) {
  var PersonalInformationManager = {
    /**
     * 个人信息添加
     * @param params
     * @returns 
       */

    userInfoAdd: function (params) {
      return $http.post(api+'/cp/personal', params).then(function (result) {
        return result;
      });
    },
    /**
     * 机构信息添加
     * @param params
     * @returns
     */

    companyInfoAdd: function (params) {
      return $http.post(api+'/cp/company/companies', params).then(function (result) {
        return result;
      });
    },
    /**
     * 个人信息修改
     * @param params
     * @returns result
       */
    userInfoEdit: function (params) {
      return $http.put(api+'/cp/personal', params).then(function (result) {
        return result;
      });
    },
    /**
     * 机构信息修改
     * @param params
     * @returns result
       */
    companyInfoEdit: function (cpId,params) {
      return $http.put(api+'/cp/company/companies/'+cpId,params).then(function (result) {
        return result;
      });
    },

      /**
       * 获取个人信息
       * @returns result
       */
    userInfoDetail:function () {
      return $http.get(api+'/cp/personal').then(function (result) {
        return result;
      });
    },
    /**
       * 获取机构信息
       * @returns result
       */
    companyDetail:function (cpId) {
      return $http.get(api+'/cp/company/companies/'+cpId).then(function (result) {
        return result;
      });
    },
    /**
     * 密码修改
     * @returns result
     */
    userPassword:function (params) {
      return $http.put(api+'/cp/password',params).then(function (result) {
        return result;
      });
    }





  };

  return PersonalInformationManager;
}]);
